Product : ISaGRAF V3

Date    : 17-December-1999

File    : Other functions for string management.htm

Subject : How to enable new functions for string management

Keywords: function - string - message

____________________________________________________________________

Some new functions were created with version 3.23 of ISaGRAF kernel

and workbench.

They allow special management of strings containing null characters:

MLEN_BIN: Calculates the length of a message string (even if null characters).

MSG_ALG: Extract two specified bytes of data from within a defined message and produces a 16 bit integer output.

ALG_MSG: Takes a 16 bit user defined integer, divides the integer into 2 bytes and exports the component parts to 2 consecutive positions within a message when enabled.

MSG_BOO: Extract a single bit from a configured position within a defined byte from a message.

BOO_MSG: The function sets a single bit within a defined position of a byte for a message equal to an input bit.

MULT_M_A: Extract the same bit from the same byte within a number of messages.

OR_MSG: Extract the same bit from the same byte within a number of messages and performs a logical OR function.

AND_MSG: Logical AND between multiple messages.

How to validate those functions on the workbench

- remove the exclamation mark at the beginning of the lines that start as below in ISA.SMB file located in ISaGRAF EXE folder:

!#F,INTERN,INTEGER,G,R,MLEN_BIN,O,1,MESSAGE,STD,50

!#F,INTERN,INTEGER,G,R,MSG_ALG,O,3,MESSAGE,INTEGER,INTEGER,STD,51

!#F,INTERN,MESSAGE,G,R,ALG_MSG,O,4,INTEGER,INTEGER,INTEGER,MESSAGE,STD,52

!#F,INTERN,BOOLEAN,G,R,MSG_BOO,O,3,MESSAGE,INTEGER,INTEGER,STD,53

!#F,INTERN,MESSAGE,G,R,BOO_MSG,O,4,BOOLEAN,INTEGER,INTEGER,MESSAGE,STD,54

!#F,INTERN,INTEGER,G,R,MULT_M_A,O,10,MESSAGE,...

!#F,INTERN,BOOLEAN,G,R,OR_MSG,O,10,MESSAGE,...

!#F,INTERN,BOOLEAN,G,R,AND_MSG,O,10,MESSAGE,...

- in ISA.LIB, also located in the EXE folder of ISaGRAF, remove the ';' character at the beginning of all lines describing those same functions

 

Specification:

 

MLEN_BIN:

input:

IN: message: Any string message

output:

NbC: integer: Number of characters in the IN string

desc: Calculates the length of a message string. Difference between MLEN_BIN and MLEN is that MLEN_BIN accept string with null character inside the string.

 

MSG_ALG:

input:

INPUT: message: Any non empty string

POSITION: integer: First byte position within the message instruction from which to extract the analogue integer data. Range:0-254

MASK: integer: Mask bit from analogue integer data extracted from message instruction. Default=65536 (dec.)

output:

OUTPUT: integer: Resultant analogue integer data including MASK function.

desc: Gets two specified bytes of data from within a defined message and produces a 16 bit integer output. Bits within the returned data will be logically ANDed with a user definable mask function prior to output

 

ALG_MSG:

input:

INPUT: integer: Analogue integer data to be imported to message.

POSITION: integer: First byte position within the message instruction for which to import the analogue integer data. Range:0-254

MASK: integer: Mask bits from analogue integer data prior to importing to message instruction. Default = 65536(dec.)

MESSAGE: message: Message in which the analog variable is to be imported.

output:

OUTPUT: message: Destination message for which to import the analogue integer data following execution of the MASK function.

desc: Takes a 16 bit user defined integer, divides the integer into 2 bytes and exports the component parts to 2 consecutive positions within a message when enabled. Bits within the 16 bit integer data will be logically ANDed with a user definable MASK function prior to export the message.

 

MSG_BOO:

input:

INPUT: message: Any non empty string

POSITION: integer: Byte position within the message instruction from which to extract the data. Range:0-254

OFFSET: integer: Bit position within the message byte. Range 0-7

output:

OUTPUT: boolean: Resultant bit.

desc: The function extracts a single bit from a configured position within a defined byte from a message.

BOO_MSG:

input:

INPUT: boolean: Data bit.

POSITION: integer: Byte position within a message. Range:0-254

OFFSET: integer: Bit position within message byte. Range 0-7

MESSAGE: message: Message in which the bit variable is to be imported.

output:

OUTPUT: message: Message for which to set a defined bit within a defined byte.

desc: The function sets a single bit within a defined position of a byte for a message equal to an input bit.

 

MULT_M_A:

input:

INPUT1..INPUT8: messages: Non empty strings

POSITION: integer: Common byte position within each message instruction from which to extract data. Range: 0-254

OFFSET: integer: Bit position within each message byte. Range: 0-7

output:

OUTPUT: integer: Resultant bits represented as an analogue variable. The result for message 1 is represented as bit 0, message 2 as bit 1 etc. up to and including message 8 represented as bit 7. Bits 8 -31 for the analogue variable are not used.

desc: Retrieves the same bit from the same byte within a number of messages. The result for message 1 is represented as bit 0, message 2 as bit 1 etc. up to and including message 8 represented as bit 7. Bits 8 -31 for the analogue variable are not used.

 

OR_MSG:

input:

INPUT1..INPUT8: messages: Non empty strings

POSITION: integer: Common byte position within each message from which to extract data. Range: 0-254

OFFSET: integer: Bit position within each message byte. Range: 0-7

output:

OUTPUT: boolean: Logical OR result for selected bits.

desc: Retrieves the same bit from the same byte within a number of messages and performs a logical OR function. The resultant bit is set as an output.

 

AND_MSG:

input:

INPUT1..INPUT8: messages: Non empty strings

POSITION: integer: Common byte position within each message instruction from which to extract data. Range: 0-254

OFFSET: integer: Bit position within each message byte. Range: 0-7

output:

OUTPUT: boolean: Logical AND result for selected bits.

desc: Logical AND between multiple messages. Gets the same bit from the same byte within a number of messages and perform a logical AND function. The resultant bit will be set to an output.

____________________________________________________________________

Copyright © 1996-2009 ICS Triplex ISaGRAF Inc. All rights reserved.